package com.ithema.assigningoperator;

public class AssigningOperatorDemo1 {
    public static void main(String[] args) {
        //+=
        //规则：将做左边和右边相加，并赋值给左边
        int a = 10;
        int b = 20;
        a += b;//等同于 a = a + b;
        System.out.println(a);
        System.out.println(b);

        //细节
        //+=、-=、*=、/=、%= 底层都隐藏了一个强制类型转换
        short s = 1;
        s += 1;
        //等同于：s = (short)(s + 1);
        System.out.println(s);//2
    }
}
